@extends('agent.mainlayout')
@section('title')
    <div class="title"><span>系统公告></span></div>
@endsection
@section('content')
    <div class="five">
        <table id="kuxuan">
            <tr>
                <th>序号</th>
                <th>标题</th>
                <th>内容</th>
                <th>时间</th>
                <th>详情</th>
            </tr>
            @if(!empty($res['data']))
                @foreach($res['data'] as $v)
            <tr>
                <td>{{$v['id']}}</td>
                <td>{{$v['title']}}</td>
                @if(strlen($v['content'])>24)
                    <td>{{mb_substr($v['content'],0,10)}}...</td>
                @else
                    <td>{{$v['content']}}</td>
                @endif
                <td>{{$v['created_at']}}</td>
                <td style="cursor: pointer;" onclick="fn('{{$v['content']}}');">查看详情</td>
            </tr>
                @endforeach
                @else
                <tr>
                    <td colspan="5">暂无公告...</td>
                </tr>
            @endif

        </table>
        <div class="del">
            <div class="bot">
                @if($res['prev_page_url'])
                    <p class="prev"><a href="{{$res['prev_page_url']}}">上一页</a></p>
                @endif
                <ul>
                    @foreach($res['pageNoList'] as $v)
                        <li @if($res['current_page'] ==  $v )class="active_list" @endif ><a href="/center/announceag?page={{$v}}">{{$v}}</a></li>
                    @endforeach
                </ul>
                @if($res['next_page_url'])
                    <p class="next"><a href="{{$res['next_page_url']}}">下一页</a></p>
                @endif
            </div>
        </div>
    </div>
@endsection
<script>

    function fn(a){

        layer.open({
            type: 1,
            skin: 'layui-layer-rim', //加上边框
            area: ['420px', '240px'], //宽高
            content: a
        });

    }

    window.onload = function(){

        /****酷炫效果*****/
        var oTable = document.getElementById('kuxuan');
        var aLi = oTable.getElementsByTagName('tr');
        //var arr = ['red','blue','grey'];
        var str = '';
        for(var i=1;i<aLi.length;i++){

            //aLi[i].style.background = arr[i%3];

            aLi[i].onmouseover = function(){
                str = this.style.background;      //将原来的颜色保存起来
                this.style.background = '#2bdacf';
            }

            aLi[i].onmouseout = function(){
                this.style.background = str;
            }

        }
        /****酷炫效果******/


    }

</script>